import { Toast } from 'antd-mobile';
import React from 'react'
import { Navigate } from 'react-router-dom';

function WithAuth(Com) {
    console.log(Com);

    return () => {
        let token = localStorage.getItem('token');
        if (token) {
            return <Com></Com>
        } else {
            Toast.show('请先登录')
            return <Navigate to='/login'></Navigate>
        }
    }
}

export default WithAuth
